//
//  BaseTabBarController.m
//  TelemedCloud
//
//  Created by YT on 2018/5/7.
//  Copyright © 2018年 YT. All rights reserved.
//

#import "BaseTabBarController.h"
#import "BaseNavigationController.h"
#import "HomeViewController.h"
#import "MessageViewController.h"
#import "MyViewController.h"

@interface BaseTabBarController ()

@end

@implementation BaseTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    //FIXME:-YT修改
    NSArray *navArray = @[
    [self createNavigationController:[HomeViewController class] image:@"tb_hove" selectImage:@"tb_hove1" title:L(@"table_Home")],
    [self createNavigationController:[MessageViewController class] image:@"tb_zixun" selectImage:@"tb_zixun1" title:L(@"table_Message")],
    [self createNavigationController:[MyViewController class] image:@"tb_wode" selectImage:@"tb_wode1" title:L(@"table_Mine")]];
    [self setViewControllers:navArray];
    self.tabBar.barTintColor = SEPARATOR_COLOR;
    self.tabBar.translucent = NO;
    //       self.tabBar.tintColor = [UIColor redColor];
    self.selectedIndex = 0;
}

- (BaseNavigationController *)createNavigationController:(Class)class image:(NSString *)image selectImage:(NSString *)selectImage title:(NSString *)title{
    BaseNavigationController *nav = [[BaseNavigationController alloc] initWithRootViewController:[class new]];
    nav.tabBarItem.title = title;
    
    [[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor blackColor], NSForegroundColorAttributeName, [UIFont fontWithName:@"Helvetica" size:12.5f],NSFontAttributeName,nil] forState:UIControlStateNormal];
    [[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor colorWithRed:29/255.0 green:143/255.0 blue:225/255.0 alpha:1], NSForegroundColorAttributeName, [UIFont fontWithName:@"Helvetica" size:12.5f],NSFontAttributeName,nil] forState:UIControlStateSelected];
    
    nav.tabBarItem.image = [UIImage imageNamed:image];
    nav.tabBarItem.selectedImage = [UIImage imageNamed:selectImage];
    return nav;
}
@end
